package com.tcm.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tcm.entity.Permission;
import com.tcm.entity.dto.param.PermissionRoleUpdateParam;
import com.tcm.entity.resp.PageR;
import com.tcm.entity.vo.PermissionListResult;
import com.tcm.entity.vo.RoleSelectResult;
import com.tcm.exception.DatabaseOperationException;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Guqier
 * @version 1.0
 * @date 2023/7/2 19:58
 */
public interface PermissionService extends IService<Permission> {
    PageR<RoleSelectResult> getRoleListByPage(Integer pageNum, Integer pageSize);

    List<PermissionListResult> getPermissionList();

    List<PermissionListResult> getPermissionByRoleId(Long roleId);

    boolean modifyPermissionForRole(PermissionRoleUpdateParam param, Long currUserId) throws DatabaseOperationException;

    @Transactional
    boolean addRole(String roleKey, String roleName, String des, Long currUserId);

    @Transactional
    boolean removeRole(Long id, Long currUserId) throws Exception;

    List<String> getPermissionKeyByUserId(Long userId);
}
